<!DOCTYPE html>
<html>
	<head>
		<include file="Public/head" />
		<link rel="stylesheet" href="__PUBLIC__/Manage/css/table.css">
		<title>资料审核</title>
		<style>
			.redText{
				color: red;
			}
			.resetInfo-item{
			    min-width: 165px;
			    font-size: 14px;
			}
			.resetInfo-item h3{
				font-size: 20px;
				margin-left: 20px;
			}
			.resetInfo-item select{
				margin-left: 20px;
				margin-top: 8px;
			}
			.resetInfo-item button{
				margin: 20px 0 10px 20px;
				width: 120px;
			    color: #fff;
			    background-color: #51a0f1;
			    border: 0;
			    border-radius: 4px;
			}
		</style>
		
	</head>
	<body>
		<div class="nestable">
			<div class="console-title console-title-border drds-detail-title clearfix">
				<h5>资料审核</h5>
			</div>
			<form method="get" id="seachForm">
				<input type="hidden" name="m" value="Info" />
				<input type="hidden" name="a" value="index" />
				<div class="public-selectArea">
					<div class="clearfix">
						<div class="wp_box col-xs-6">
							<dl>
								<dt>用户名：</dt>
								<dd>
									<input type="text" name="s-username" value="{$Think.get.s-username}">
								</dd>
							</dl>
						</div>
						<div class="wp_box col-xs-6">
		                	<dl>
		                    	<dt>资料状态：</dt>
		                        <dd>
		                          	<select class="select" name="status">
		                                <option value="" selected="selected">全部</option>
		                                <option value="0">不完善</option>
		                                <option value="1">待审核</option>
		                                <option value="2">审核通过</option>
		                                <option value="-1">不通过</option>
		                            </select>
		                        </dd>
		                    </dl>
						</div>
					</div>
					<div class="btnArea">
						<a href='javascript:$("#seachForm").submit();' class="btn btn-sereachBg">
							<i class="glyphicon glyphicon-search public-ico"></i>
							<span class="public-label">查询</span>
						</a>
					</div>
				</div>
			</form>
			<div class="scroll-bar-table">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>序号</th>
							<th>用户名/手机号</th>
							<th>姓名</th>
							<th>身份证</th>
							<th>审核结果</th>
							<th>预期金额</th>
							<th>资料</th>
							<th>申请时间</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
<volist name="list" id="vo">
						<tr id="list-{$vo.id}">
							<td align="center">{$vo.id}</td>
							<td>{$vo.user.telnum}</td>
							<td>
							<php>$identity = json_decode($vo['identity'],true);</php>
							 {$identity.name|default="未填写"}
							
							</td>
							<td>
							
							 {$identity.idcard|default="未填写"}
							
							</td>
							<td>
								<if condition="$vo['status'] eq 0">资料未完善</if>
								<if condition="$vo['status'] eq 1"><span class="redText">等待审核</span></if>
								<if condition="$vo['status'] eq -1">未通过审核</if>
								<if condition="$vo['status'] eq 2">审核通过</if>
							</td>
							<td align="center">{$vo.user.quota}</td>
							<td class="td-status">
								<a href="{:U('Info/view',array('uid'=>$vo['uid']))}" target="_blank">点击查看</a>
							</td>
							<td >{$vo.create_time|date='Y-m-d h:i:s',###}</td>
							<td class="text-left">
						 <a href="javascript:sendMsg('{$vo.user.telnum}');">短信</a>
								<span>|</span> 
								<if condition="$vo['status'] eq 0">
									
								</if>
								<if condition="$vo['status'] eq 1">
								
									<a href="javascript:Adopt('{$vo.uid}','{$vo.user.telnum}');">通过并授权</a>
									<span>|</span>
									<a href="javascript:Refuse('{$vo.uid}','{$vo.user.telnum}');">不符合条件</a>
									 
								</if>
								<if condition="$vo['status'] eq -1">
								 
									<a href="javascript:resetInfo('{$vo.id}');">重置资料</a>
									<span>|</span>
									<a href="javascript:Adopt('{$vo.uid}','{$vo.user.telnum}');">二审通过额度</a>
								
									
								</if>
								<if condition="$vo['status'] eq 2">
									 
									<a href="javascript:resetInfo('{$vo.id}');">重置资料</a>
								</if>
							</td>
						</tr>
</volist>
					</tbody>
				</table>
			</div>
			<div class="table-pagin-container">
				<div class="pull-right page-box">
					{$page}
				</div>
			</div>
			<div class="resetInfo" style="display: none;">
				<form action="{:U('Info/resetInfo')}" method="post">
					<input type="hidden" name="id" value="" id="resetInfoId" />
					<div class="resetInfo-item">
						<h3>选择重置项</h3>
						<select name="action">
							<option value="all">全部</option>
							<option value="identity">身份信息</option>
							<option value="contacts">联系人信息</option>
							<option value="bank">收款银行信息</option>
							<option value="addess">联系地址及其他</option>
							<!--<option value="mobile">运营商数据</option>
							<option value="taobao">淘宝数据</option>-->
						</select>
					</div>
					<div class="resetInfo-item">
						<button type="button">确定</button>
					</div>
				</form>
			</div>
		</div>
		<div style="display: none;" id="changestatus_div3">
    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic" style="background-color: #fff;">
        <tr>
		 
			<td >
				
<textarea id="vicsvhtml" name="vicsvhtml"   style="width:100%;height:50px">
				</textarea>
				<br/>
			 可自己输入，注意长度。</td>
        </tr>
        
		<tr>
           
            <td style="border:none;">
			<a href="javascript:;" onclick="victz('{$arrayInfo.info_adopt}');"><p class="yss">资料通过</p></a>
			<a href="javascript:;" onclick="victz('{$arrayInfo.info_refuse}');"><p class="yss">资料不通过</p></a>
			<a href="javascript:;" onclick="victz('{$arrayInfo.info_reset}');"><p class="yss">资料重置</p></a>			
			</td>
        </tr>
		<tr>
             
            <td style="border:none;">
				<input type="hidden" id="vicoid" value="">
                <input type="submit" onclick="sendMsg1(this);" class="btn" style="margin: 0px 5px;" value="发送消息">
           </td>
        </tr>
    </table>
</div>
<style>
		tr {
    background-color: #F9F9F9;
    color: #666666;
    border-left: 1px dotted #CCCCCC;
    border-top: 1px dotted #CCCCCC;
	display: table-row;
    vertical-align: inherit;
    border-color: inherit;
}
td,th {
    border-right: 1px dotted #CCCCCC;
    border-bottom: 1px dotted #CCCCCC;
	
}
			#list a{
				color:#06C;
			}
			#list a:hover {text-decoration:underline;} 
			.yss {
				color:#06C;
				float: left;

				padding: 8px 25px;
				margin: 15px 5px;

				font-size: 12px;
				font-weight: normal;
				text-align: center;
				border: 1px solid transparent;
				border-radius: 4px;
				background-color: #f2f2f2;
			}
			.btn {
    display: inline-block;
    background-color: #0072C6;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    border: 0;
    color: #FFF;
    padding: 6px 15px;
    font-weight: bold;
    text-transform: capitalize;
    cursor: pointer;
    -webkit-appearance: none;
}
		</style>
	</body>
	<script>
	
	
	
function victz(tz){
		 	$('.layui-layer-content #vicsvhtml').prop('value',tz);
	 
			  
			 
		 	
	}
	function sendMsg(id){
		$('#vicoid').attr('value',id);
			$('#vicsvhtml').text('{$arrayInfo.info_adopt}');
	 
		
        layer.open({
            type: 1,
            title: '是否给"'+id+'"发送提示短信？',
            skin: 'layui-layer-rim', //加上边框
            area: ['450px', '250px'], //宽高
            content: $("#changestatus_div3").html()
        });
    }
	
	
	
	 function sendMsg1(){
	 	
 
 var phone=$('#vicoid').val();
 var pass=$('.layui-layer-content #vicsvhtml').val();

				 $.post(
				"/Loan/sendsms.html",
				{conten:encodeURI(pass),phone:phone},
				function(data){
				 
					if(data.status!=1){
						layer.msg(data.info);
					}else{								
						layer.msg(data.info);
						
					}
				}
			);
	 
		 
	}
	
		//资料审核通过并设置用户额度
		function Adopt(uid,name){
			layer.prompt(
				{
					title: '为用户  ['+name+'] 设定额度',
					formType: 0,
					value:'{:C("Money_defult")}'
				},
				function(quota,index){
					cvphp.post(
						"{:U('Info/adopt')}",
						{
							uid:uid,
							quota:quota
						},
						function(data){
							if(data.status!=1){
								layer.msg(data.info);
							}else{
								layer.close(index);
								layer.msg("审核完成");
								setTimeout(function(){location.reload();},1000);
							}
						}
					);
				}
			);
		}
		//资料不通过
		function Refuse(uid,name){
			layer.confirm(
				'确认将用户[ '+name+' ]资料设置为不通过吗？',
				{
					btn: ['确认','取消']
				},function(){
					cvphp.post(
						"{:U('Info/refuse')}",
						{
							uid:uid
						},
						function(data){
							if(data.status!=1){
								layer.msg(data.info);
							}else{
								layer.alert("用户资料处理完成");
								setTimeout(function(){location.reload();},1000);
							}
						}
					);
				}
			);
		}
		//重置资料
		function resetInfo(id){
			$("#resetInfoId").val(id);
			layer.open({
				type: 1,
				shade: false,
				title: false, //不显示标题
				content: $('.resetInfo'),
			});
		}

		$(function(){
			$(".resetInfo-item button").on('click',function(){
				cvphp.submit($(".resetInfo form"),function(data){
					if(data.status!=1){
						layer.msg(data.info);
					}else{
						layer.alert("用户资料处理完成");
						setTimeout(function(){location.reload();},1000);
					}
				});
			});
		});
	</script>
</html>